#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   10:20
# Author     : Y4
# Site       : 
# File       : 12 面向对象-访问权限.py

class Student:
    def __init__(self, username, socre):
        self.__username = username
        self.__socre = socre

    def getName(self):
        return self.__username

    def getScore(self):
        return self.__socre


s = Student("姚涵", 100)
username = s.getName()
print(username)


class student1:
    def __init__(self, name):
        self.__name = name

    @property
    def name(self):
        return self.__name

    @name.setter  # x.setter这里要和方法名相同
    def name(self, name):
        self.__name = name


std1 = student1("wdng")
print(std1.name)
std1.name = "wand"
print(std1.name)
